﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace iReaper.IndexBuilder
{
    /// <summary>
    ///  Channel represents the concept of rss channel. Each channel object represents a content source.
    ///  e.g. MSDN China webcast, Channel 9.
    ///  Different content source have different index format, hence we have different parsers.
    ///  All the parser will return a channel object which contains formatted information.
    /// </summary>
    public class Channel
    {
        public Channel()
        {
            Items = new List<ContentItem>();
        }

        public string Description
        {
            get;
            set;
        }
        /// <summary>
        /// Get or set the tittle of this channel
        /// </summary>
        public string Title
        {
            get;
            set;
        }

        /// <summary>
        /// Get or set the default URL of this channel.
        /// </summary>
        public Uri Link
        {
            get;
            set;
        }

        /// <summary>
        /// Get or set the last update time.
        /// </summary>
        public DateTime LastUpdateTime
        {
            get;
            set;
        }

        /// <summary>
        /// Get or set the image Url of this channel.
        /// </summary>
        public Uri Image
        {
            get;
            set;
        }

        public List<ContentItem> Items
        {
            get;
            set;
        }

        #region Nested class

        public class ContentItem
        {
            
            public string Titile
            {
                get;
                set;
            }

            /// <summary>
            /// Get or set the description of this content
            /// </summary>
            public string Description
            {
                get;
                set;
            }

            /// <summary>
            /// Get or set the publish Date of this content.
            /// </summary>
            public DateTime DateOfPublish
            {
                get;
                set;
            }

            public string Author
            {
                get;
                set;
            }

            public Uri Url
            {
                get;
                set;
            }

            public Media[] Medias
            {
                get;
                set;
            }
        }
        /// <summary>
        ///  Media represents the concepts defined in xmlns:media="http://search.yahoo.com/mrss/".
        /// </summary>
        public class Media
        {
            /// <summary>
            /// Get or set the the MIME type of this media
            /// </summary>
            public string ContentType
            {
                get;
                set;
            }

            /// <summary>
            /// Get or set the destinaion Url of this media.
            /// </summary>
            public Uri Url
            {
                get;
                set;
            }
    
            /// <summary>
            /// Get or set the binary size of this media.
            /// </summary>
            public long ContentLength
            {
                get;
                set;
            }

        }

        #endregion

    }
}
